package com.gmail.viktor.yuryev.strategy;

import com.jcraft.jsch.ChannelSftp;
import com.jcraft.jsch.Session;
import com.jcraft.jsch.SftpException;

import java.io.File;

/**
 * Created by com.viktor.yuryev.com.gmail.viktor.yuryev on 4/7/2014.
 */
public class SimpleStrategy extends AbstractUploadStrategy {
    public SimpleStrategy(Session session) {
        super(session);
    }

    @Override
    protected void uploadInternal(File srcFile, String destFolder) throws SftpException {
        sftp.cd(destFolder);
        System.out.println(destFolder);
        sftp.put(srcFile.getAbsolutePath(), destFolder, ChannelSftp.OVERWRITE);
        System.out.println("uploaded");
    }

    @Override
    protected String getCommand(String cmd) {
        return cmd;
    }
}
